Predicting the price direction of Petrobras stock - PETR4

In this project, I use Random Forest and AdaBoost models to predict if a stock price will increase or decrease in the next hour based on data of the last hour. It was presented as the final paper in the Specialization Course in Machine Learning at PUC Minas University, in 2022.

Introduction

The prediction of stocks’ price movement is complex since price data presents high volatility and high noise levels. Nonetheless, several studies have pointed out the possibility to take advantage of market inefficiencies to predict stocks’ movements. This projects uses sentiment analysis, technical indicators and other features to predict the price movement of PETR4 with two algorithms: Random Forest and Adaboost.


Data Employed

Data scheme - stock price prediction

Steps

  1. Gathering data with the following Python libraries: yfinance, tweepy, pytrends;
  2. Feature Engineering, missing data and outliers treatment Missing data imputation Outlier treatment
  3. Visualizing and getting insights from data; Data Visualization
  4. Training the models, hyperparameters tunning, backtesting and evaluation.


Main Learnings